function selectItem (id) {
        if (XMLLock == 1) return;
  if (selectedItem != "" && document.getElementById("s" + selectedItem) != null) { //Deselect selected
    var oSpan = document.getElementById("s" + selectedItem);
    oSpan.className = "notSelected"
  }
  var pSpan = document.getElementById("s" + id); //Select new
  //alert("s" + id + "   " + pSpan);
  selectedItem = id;
  pSpan.className = "selected"
  var node = document.getElementById("a" + id);
  node.focus();
  var idiv = document.getElementById("i" + id); //Select new
  //document.getElementById("info").innerHTML = "&nbsp;" + LoadingText;
  //window.open(idiv.datHref, "XML");
  //alert(idiv.datHref);
  if (idiv.datHref != "") {
  	loadXMLFile('nfo', idiv.datHref, 1);
  	//window.open (idiv.datHref);
  }
  if (idiv.datSelect != null && idiv.datSelect != "") {
    loadXMLFile('r', idiv.datSelect, 1);
    //window.open (idiv.datSelect);
  }
  if (ie) window.scrollTo(node.offsetLeft - 15, node.offsetTop - window.document.body.clientHeight/2);
}

function MoveLeft() {
  var id = "";
  if (selectedItem == "") { //Select first
    var node = document.getElementById("iroot");
    for (i = 0; i < node.childNodes.length; i++) {
      if (node.childNodes[i].nodeType == 1) {
        id = node.childNodes[i].id;
        break;
      }
    }
  }
  else {
    var node = document.getElementById(selectedItem);
    var node1 = document.getElementById("i" + selectedItem);
    if (node1 != null && node1.subHref != "" && node1.style.display != "none") {
      expandCollapseItem(selectedItem);
    }
    else {
      node = node.parentNode;
      if (node != null && node.id != "iroot") {
        node = node.parentNode;
        if (node != null) id = node.id;
      }
    }
  }
  if (id != "") selectItem(id);
}

function MoveUp() {
  var id = "";
  if (selectedItem == "") MoveLeft(); //Select first
  else { //Select upper
    var node = document.getElementById(selectedItem);
    var node1 = node.previousSibling;
    if (node1 != null && node1.nodeType == 1) {
      var pnode = node.parentNode
      var pnode1 = node1.parentNode
        if (pnode != null && pnode1 != null && pnode.id == pnode1.id)
        id = node1.id;
    }
    else {
      MoveLeft();
      return;
    }
  }
  if (id != "") {
    selectItem(id);
  }
}

function MoveRight() {
  var id = "";
  if (selectedItem == "") MoveLeft(); //Select first
  else {
    var node = document.getElementById(selectedItem);
    var node1 = document.getElementById("i" + selectedItem);
    if (node1 != null && node1.subHref != "") {
      if (node1.style.display != "none") {
        for (i = 0; i < node1.childNodes.length; i++) {
          if (node1.childNodes[i].nodeType == 1 && node1.childNodes[i].tagName == "DIV") {
            id = node1.childNodes[i].id;
            break;
          }
        }
        if (id != "") selectItem(id);
      }
      else expandCollapseItem(selectedItem);
    }
  }
}

function MoveDown() {
  var id = "";
  if (selectedItem == "") MoveLeft(); //Select first
  else {
    var node = document.getElementById(selectedItem);
    var node1 = document.getElementById("i" + selectedItem);
    if (node1 != null && node1.style.display != "none") {
      MoveRight();
      return;
    }
    node1 = node.nextSibling;
    if (node1 != null && node1.nodeType == 1) {
      var pnode = node.parentNode
      var pnode1 = node1.parentNode
      if (pnode != null && pnode1 != null && pnode.id == pnode1.id) id = node1.id;
    }
    else {
      if (node.parentNode != null && node.parentNode.nodeType == 1 && node.parentNode.id != "iroot") {
        node = node.parentNode.parentNode;
        if (node != null) id = node.id;
        node1 = node.nextSibling;
        if (node1 != null && node1.nodeType == 1) {
          var pnode = node.parentNode
          var pnode1 = node1.parentNode
          if (pnode != null && pnode1 != null && pnode.id == pnode1.id) id = node1.id;
        }
      }
    }
  }
  if (id != "") {
    selectItem(id);
  }
}

function KeyDown(e) {
/*  if (ie) e = window.event;
  var keyCode = e.keyCode;
        switch (keyCode) {
          /*case 13 : // enter key //113 - F2
            objLI = window.event.srcElement.parentElement;
            LoadNodeContent(objLI);
            break;*//*
          case 37 : // left key
            MoveLeft();
            e.returnValue = false;
            break;
          case 38 : // up key
            MoveUp()
            e.returnValue = false;
            break;
          case 39 : // right key
            MoveRight()
            e.returnValue = false;
            break;
          case 40 : // down key
            MoveDown()
            break;
          default :
            break;
        }  */
}